package balance

import (
	"net/http"
)

// 轮询策略
func (service *Service) roundBalance(req *http.Request) (int,error) {
	service.Lock.Lock()
	defer service.Lock.Unlock()
	if service.CountInfo.robinIndex >= service.CountInfo.Len {
		service.CountInfo.robinIndex = 0
	}
	index := service.CountInfo.robinIndex
	service.CountInfo.robinIndex ++
	return index,nil
}
